Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
What is the definition of "scope" when we are talking about function hoisting in JavaScript

I am learning JavaScript Function Hoisting, which says "the declaration of functions are moved to the top of their scope". Then I read the definition of "scope" from this doc, it says "A function serves as a closure in JavaScript, and thus creates a scope". So does it mean any functions declared inside a function are moved to the top of that function? I use the following example to test:

foo();

function foo() {
   console.log(too);
   console.log(zoo);
   {
      function too() {console.log("too");}
   }
   function zoo() {console.log("zoo");}
}

The out put is

undefined
ƒ zoo() {console.log("zoo");}

So obviously the declaration of too is not moved to the top of foo. It is actually moved to the top of the block statement inside foo. So what is the exact definition of "scope" when we are talking about function hoisting in JavaScript?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda